/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gr.sample;

import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
 *
 * @author Hieudt
 */

public class XMLparse {
public static void main(String[] args) {
try {
DocumentBuilderFactory fap = DocumentBuilderFactory.newInstance();
DocumentBuilder build = fap.newDocumentBuilder();
File fi=new File("D:/vnExpress2/vnexpress.net-GL-Kinh-doanh-2007-05-3B9F596A-.xml");
long start = System.currentTimeMillis(); 
Document document=build.parse(fi);

// Lay nut goc cua xml
Element ele=document.getDocumentElement();
 ele.getTextContent();
//if(com==0) break;
System.out.println("***********\n"+ ele.getTextContent());
 long end = System.currentTimeMillis(); 
  System.out.println("load 20 user data in "+(end-start)+"milis");
} catch (ParserConfigurationException | SAXException | IOException | DOMException ex) {
System.err.println("err");
}
}
}